package com.sayimo.maker.mall.orders.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sayimo.framework.common.AbstractBaseService;
import com.sayimo.framework.exception.DaoException;
import com.sayimo.framework.exception.ServiceException;
import com.sayimo.maker.mall.orders.dao.OrdersFlowInterfaceDao;
import com.sayimo.maker.mall.orders.service.OrdersFlowInterfaceService;
import com.sayimo.maker.mall.orders.vo.GenerateOrdersFlowParams;
import com.sayimo.maker.mall.orders.vo.OrdersFlow;


@Service(value = "ordersFlowInterfaceService")
public class OrdersFlowInterfaceImplService extends AbstractBaseService implements OrdersFlowInterfaceService {

	@Resource(name = "ordersFlowInterfaceDao")
	private OrdersFlowInterfaceDao ordersFlowInterfaceDao;

	@Override
	public Integer insertOrdersFlow(GenerateOrdersFlowParams generateOrdersFlow) throws ServiceException {
		OrdersFlow ordersFlow = new OrdersFlow();
		ordersFlow.setOrdersId(generateOrdersFlow.getOrdersId());
		ordersFlow.setStatus(generateOrdersFlow.getStatus());
		ordersFlow.setActionUser(generateOrdersFlow.getMemberId());
		try {
			return ordersFlowInterfaceDao.insertOrdersFlow(ordersFlow);
		} catch (DaoException de) {
			throw new ServiceException(de);
		}
	}

	/**
	 * 
	 * @MethodName batchInsertOrdersFlow
	 * @Description 批量新增订单流程
	 * 
	 * @author chenpy
	 * @date 2016年1月8日 下午4:25:29
	 * @param 
	 * @return int
	 * @VERSION 1.0.0
	 */
	public int batchInsertOrdersFlow(List<OrdersFlow> flows) throws ServiceException {
		try {
			return this.ordersFlowInterfaceDao.batchInsertOrdersFlow(flows);
		} catch (DaoException e) {
			throw new ServiceException(e);
		}
	}

	/**
	 * 
	 * @MethodName insertProviderOrdersFlow
	 * @Description 新增订单流程
	 * 
	 * @author chenpy
	 * @date 2016年1月8日 下午4:25:29
	 * @param 
	 * @return int
	 * @VERSION 1.0.0
	 */
	@Override
	public void insertProviderOrdersFlow(OrdersFlow flow)
			throws ServiceException {
		try {
			 this.ordersFlowInterfaceDao.insertProviderOrdersFlow(flow);
		} catch (DaoException e) {
			throw new ServiceException(e);
		}
		
	}

}
